#include "mainmenu.h"
#include <QtGui>
#include "wndmanager.h"

//------------------------------------------------------------------------------
// PUBLIC INTERFACES
//------------------------------------------------------------------------------

MainMenu::MainMenu(QWidget *parent)
	: QWidget(parent)
{
	ui.setupUi(this);

	connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(menuSelected()));
	connect(ui.fileButton, SIGNAL(clicked()), this, SLOT(menuSelected()));
	connect(ui.editButton, SIGNAL(clicked()), this, SLOT(menuSelected()));
	connect(ui.measButton, SIGNAL(clicked()), this, SLOT(menuSelected()));
}

MainMenu::~MainMenu()
{
	delete ui.loadButton;
	delete ui.fileButton;
	delete ui.editButton;
	delete ui.measButton;
	delete ui.gridLayout;
}

//------------------------------------------------------------------------------
// SLOTS
//------------------------------------------------------------------------------

void MainMenu::menuSelected()
{
	QPushButton *button = qobject_cast<QPushButton*>(sender());
	if(button == ui.loadButton){
		WndManager::gotoWnd(WndManager::kWndLoadProgramWnd);
	}else if(button == ui.fileButton){	
	}else if(button == ui.editButton){
		WndManager::gotoWnd(WndManager::kWndProgramWnd);
	}else if(button == ui.measButton){
		WndManager::gotoWnd(WndManager::kWndMeasMenu);
	}
}
